var windowName = "shopHome";
var Page,count = 0;
apiready = function(){
    onWindowShow(function () {
        if (count > 0) {
            getData(Page)
        }
        count++
    })
    onWindowHide(function () {
        console.log(windowName + " hide")
    })
    console.log("index page is OK");
    Page = createVM("#Page",{
        shop:{

        }
        ,data:{
            products:0,
            orders:0,
            incomes:0,
        },
        phone : "-"
    },{
        //页面方法
        "init":function () {
            this.shop = getLocData("shop")
            this.phone = getLocData("conf").contact
            getData(this)
        }
        ,test(){

        }
        ,call:function (phone) {
            api.call({
                type: 'tel_prompt',
                number: getLocData("conf").contact
            });
        }
    })
    Page.init()
}

function getData(_this)
{
    apiGet("/app/shop/home", {}, function (res,code) {
        _this.shop = res.data.shop
        _this.data = res.data.statistic
        setLocData("shop",_this.shop);
    });
}